|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
User's Manual SAP77016-B04 G.723.1 Speech Codec Middleware Target Devices PD77018 PD77018A PD77019 PD77110 PD77111 PD77112 PD77113 PD77114 PD77116 Document No. U13955EJ2V0UMJ1 (2nd edition) Date Published October 2000 N CP (K) 1999 (c) Printed in Japan [MEMO] 2 User's Manual U13955EJ2V0UM00 Windows is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries. * The information in this document is current as of May, 2000. The information is subject to change without notice. For actual design-in, refer to the latest publications of NEC's data sheets or data books, etc., for the most up-to-date specifications of NEC semiconductor products. Not all products and/or types are available in every country. Please check with an NEC sales representative for availability and additional information. * No part of this document may be copied or reproduced in any form or by any means without prior written consent of NEC. NEC assumes no responsibility for any errors that may appear in this document. * NEC does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of NEC semiconductor products listed in this document or any other liability arising from the use of such products. No license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of NEC or others. * Descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. The incorporation of these circuits, software and information in the design of customer's equipment shall be done under the full responsibility of customer. NEC assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. * While NEC endeavours to enhance the quality, reliability and safety of NEC semiconductor products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To minimize risks of damage to property or injury (including death) to persons arising from defects in NEC semiconductor products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment, and anti-failure features. * NEC semiconductor products are classified into the following three quality grades: "Standard", "Special" and "Specific". The "Specific" quality grade applies only to semiconductor products developed based on a customer-designated "quality assurance program" for a specific application. The recommended applications of a semiconductor product depend on its quality grade, as indicated below. Customers must check the quality grade of each semiconductor product before using it in a particular application. "Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots "Special": Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support) "Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. The quality grade of NEC semiconductor products is "Standard" unless otherwise expressly specified in NEC's data sheets or data books, etc. If customers wish to use NEC semiconductor products in applications not intended by NEC, they must contact an NEC sales representative in advance to determine NEC's willingness to support a given application. (Note) (1) "NEC" as used in this statement means NEC Corporation and also includes its majority-owned subsidiaries. (2) "NEC semiconductor products" means any semiconductor product developed or manufactured by or for NEC (as defined above). M8E 00. 4 User's Manual U13955EJ2V0UM00 3 Regional Information Some information contained in this document may vary from country to country. Before using any NEC product in your application, pIease contact the NEC office in your country to obtain a list of authorized representatives and distributors. They will verify: * * * * * Device availability Ordering information Product release schedule Availability of related technical literature Development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, AC supply voltages, and so forth) Network requirements * In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary from country to country. NEC Electronics Inc. (U.S.) Santa Clara, California Tel: 408-588-6000 800-366-9782 Fax: 408-588-6130 800-729-9288 NEC Electronics (Germany) GmbH Benelux Office Eindhoven, The Netherlands Tel: 040-2445845 Fax: 040-2444580 NEC Electronics Hong Kong Ltd. Hong Kong Tel: 2886-9318 Fax: 2886-9022/9044 NEC Electronics Hong Kong Ltd. NEC Electronics (France) S.A. Velizy-Villacoublay, France Tel: 01-30-67 58 00 Fax: 01-30-67 58 99 Seoul Branch Seoul, Korea Tel: 02-528-0303 Fax: 02-528-4411 NEC Electronics (Germany) GmbH Duesseldorf, Germany Tel: 0211-65 03 02 Fax: 0211-65 03 490 NEC Electronics (France) S.A. NEC Electronics (UK) Ltd. Milton Keynes, UK Tel: 01908-691-133 Fax: 01908-670-290 Madrid Office Madrid, Spain Tel: 91-504-2787 Fax: 91-504-2860 NEC Electronics Singapore Pte. Ltd. United Square, Singapore Tel: 65-253-8311 Fax: 65-250-3583 NEC Electronics Taiwan Ltd. NEC Electronics Italiana s.r.l. Milano, Italy Tel: 02-66 75 41 Fax: 02-66 75 42 99 NEC Electronics (Germany) GmbH Scandinavia Office Taeby, Sweden Tel: 08-63 80 820 Fax: 08-63 80 388 Taipei, Taiwan Tel: 02-2719-2377 Fax: 02-2719-5951 NEC do Brasil S.A. Electron Devices Division Guarulhos-SP Brasil Tel: 55-11-6462-6810 Fax: 55-11-6462-6829 J00.7 4 User's Manual U13955EJ2V0UM00 Major Revisions in This Edition Page Throughout p.27 p.28 p.33 Description Addition of PD77113 and 77114 to target devices Addition of description to 2.3.1 Extraction parameters for G.723.1 ANNEX A functions Addition of description to 2.3.2 Extraction parameters for G.723.1 ANNEX C functions Addition of description to 2.4.2 (2) SID frame compression format The mark shows major revised points. User's Manual U13955EJ2V0UM00 5 [MEMO] 6 User's Manual U13955EJ2V0UM00 INTRODUCTION Readers This manual has been prepared for users who design and develop application systems using the PD77016 Family. The PD77016 Family includes the following: PD77015, 77016, 77017, 77018, 77018A, 77019, 77110, 77111, 77112, 77113, 77114, and 77116 77110, 77111, 77112, 77113, 77114, and 77116. Note Under development Note . The target devices of this manual, however, only include the PD77018, 77018A, 77019, Purpose The manual is intended to give users an understanding of how to use the middleware that is used for support when designing or developing application systems using the PD77016 Family. Organization This manual is broadly divided into the following sections. Chapter 1 Outline Chapter 2 Library Specifications Chapter 3 Installation Appendix Sample Program Source How to Read This Manual It is assumed that the readers of this manual have general knowledge of electrical engineering, logic circuits, microcontrollers, and C language. To learn the hardware functions of the PD7701x Family Refer to the PD7701x Family User's Manual Architecture x To learn the hardware functions of the PD77111 Family Refer to the PD77111 Family User's Manual Architecture To learn the instruction functions of the PD77016 Family Refer to the PD77016 Family User's Manual Instructions Conventions Data significance: Active low representation: Note: Caution: Remark: Numerical representation: Higher digits on the left and lower digits on the right xxx (overscore over pin or signal name) Footnote for item marked with Note in the text Information requiring particular attention Supplementary information Binaryxxxx or 0bxxxx Decimalxxxx Hexadecimal0xxxxx User's Manual U13955EJ2V0UM00 7 Related Documents The related documents listed below may include preliminary versions. preliminary versions are not marked as such. However, Documents Related to Devices Document Name Pamphlet Part Number Data Sheet Architecture U12395E U10891E U10902E U10503E Instructions U13116E Basic Software U11958E User's Manual Application Note PD77016 PD77015 PD77017 PD77018 PD77018A PD77019 PD77019-013 PD77110 PD77111 PD77112 PD77113 PD77114 PD77116 U11849E U13053E U12801E Under preparation U14373E U14624E Documents Related to Development Tools Document Name IE-77016-98, IE-77016-PC User's Manual IE-77016-CM-LC User's Manual RX77016 User's Manual Function Configuration Tool RX77016 Application Note HOST API Hardware Document No. U13044E U14139E U14397E U14404E U14371E Caution The documents listed above are subject to change without notice. Be sure to use the latest documents when designing. 8 User's Manual U13955EJ2V0UM00 CONTENTS CHAPTER 1 1.1 1.2 1.3 1.4 1.5 OUTLINE.............................................................................................................................11 Middleware ...................................................................................................................................11 G.723.1 Speech Codec ................................................................................................................11 G.723.1 ANNEX A Speech Codec...............................................................................................12 G.723.1 ANNEX C Speech Codec...............................................................................................12 System Outline ............................................................................................................................12 1.5.1 1.5.2 1.5.3 1.5.4 Features ........................................................................................................................................ 12 Operating environment .................................................................................................................. 12 Performance .................................................................................................................................. 13 Directory configuration................................................................................................................... 14 CHAPTER 2 2.1 2.2 LIBRARY SPECIFICATIONS ............................................................................................15 G.723.1 Speech Codec Processing Flow ..................................................................................15 Function Specifications..............................................................................................................17 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 Encoder initialization functions ...................................................................................................... 17 Decoder initialization functions ...................................................................................................... 20 Encoder functions.......................................................................................................................... 22 Decoder functions.......................................................................................................................... 24 Version acquisition function........................................................................................................... 26 Extraction parameters for G.723.1 ANNEX A functions ................................................................ 27 Extraction parameters for G.723.1 ANNEX C functions ................................................................ 28 Encoder input/decoder output data format .................................................................................... 30 Encoder output/decoder input data format .................................................................................... 30 2.3 Description of External Interface ...............................................................................................27 2.3.1 2.3.2 2.4 I/O Data Format............................................................................................................................30 2.4.1 2.4.2 CHAPTER 3 3.1 3.2 3.3 INSTALLATION ..................................................................................................................35 Installation Procedure.................................................................................................................35 Sample Creation Procedure .......................................................................................................35 Symbol Naming Conventions ....................................................................................................36 SAMPLE PROGRAM SOURCE ..........................................................................................37 APPENDIX A.1 A.2 For G.723.1 + ANNEX A (sampleA.asm) ....................................................................................37 For G.723.1 + ANNEX A + ANNEX C (sampleAC.asm) .............................................................43 User's Manual U13955EJ2V0UM00 9 LIST OF FIGURES Figure No. Title Page 2-1 Application Processing Flow (Encoder)................................................................................................................ 15 2-2 Application Processing Flow (Decoder)................................................................................................................ 16 2-3 Compressed Data Frame Format ......................................................................................................................... 30 3-1 Sample Program Evaluation System .................................................................................................................... 35 LIST OF TABLES Table No. Title Page 1-1 Required Memory Capacity .................................................................................................................................. 13 2-1 Extraction Parameters for G.723.1 ANNEX A Functions...................................................................................... 27 2-2 Extraction Parameters for G.723.1 ANNEX C Functions...................................................................................... 28 2-3 Bit Rate and Frame Byte Number of G.723.1 ANNEX A Compressed Data ........................................................ 30 2-4 Bit Rate and Frame Byte Number of G.723.1 ANNEX C Compressed Data ........................................................ 30 2-5 6.3 Kbps Speech Compression Data Format ....................................................................................................... 31 2-6 5.3 Kbps Speech Compression Data Format ....................................................................................................... 32 2-7 Bit Allocation of SID Data ..................................................................................................................................... 33 2-8 Bit Allocation of ANNEX C Compression Data ..................................................................................................... 33 3-1 Symbol Names ..................................................................................................................................................... 36 10 User's Manual U13955EJ2V0UM00 CHAPTER 1 OUTLINE 1.1 Middleware Middleware is the name given to a group of software that has been tuned so that it draws out the maximum performance of the processor and enables processing that is conventionally performed by hardware to be performed by software. The concept of middleware was introduced with the development of a new high-performance processor, the DSP, in order to facilitate operation of the environments integrated in the system. By providing appropriate speech codec and image data compression/decompression-type middleware, NEC is offering users the kind of technology essential in the realization of a multimedia system for the PD77016 Family, and is continuing promotion of system development. The SAP77016-B04 is a middleware product that provides ITU-T Note -recommended G.723.1 speech compression and decompression functions (including the recommended additions ANNEX A and ANNEX C). Unless otherwise stated, when describing this middleware, it is assumed the speech codec used is G.723.1. Note International Telecommunication Union-Telecommunication Standardization Sector 1.2 G.723.1 Speech Codec The G.723.1 speech codec is the 5.3 Kbps or 6.3 Kbps speech compression/decompression codec recommended by ITU-T, and is an algorithm for coding speech data that use ACELP and MP-MLQ. By means of a telephone band filter (the ITU-T recommended G.712), the G.723.1 speech codec samples bandrestricted analog input signals at 8 kHz. The digital signals that are obtained by converting this sampled data into 16bit linear PCM data are then designed so that they operate as encoder inputs. Similarly, it is necessary to return the signals to analog form to output them from the decoder. Signals in other I/O formats, such as the 64 Kbps PCM data prescribed by the ITU-T-recommended G.711, must be converted into 16-bit linear PCM data before coding, and converted back from 16-bit linear PCM data to a suitable format after decoding. recommended G.723.1. Remark ACELP: Algebraic Code Excited Linear Prediction The bit-string that is passed from the encoder to the decoder is defined by the ITU-T MP-MLQ: Multi-Pulse Maximum Likelihood Quantization User's Manual U13955EJ2V0UM00 11 CHAPTER 1 OUTLINE 1.3 G.723.1 ANNEX A Speech Codec ANNEX A, which is an additional recommendation to the ITU-T recommended G.723.1, is the silence compression function of the G.723.1, and is used in addition to the standard G.723.1 speech codec. Speech codecs with an additional silence compression function and those without an additional silence compression function cannot, however, be interconnected. The purpose of the silence compression function is to raise the total compression rate and reduce the bit rate by raising the compression rate in the parts where there is silence. 1.4 G.723.1 ANNEX C Speech Codec ANNEX C, which is an additional recommendation to the ITU-T recommended G.723.1, is the variable bit rate channel codec of the G.723.1 speech codec, and is used in addition to the standard G.723.1 and ANNEX A. The bit rate supported by ANNEX C is 0.7 Kbps to 14.3 Kbps. ANNEX C is designed as a part of the ITU-T H.324 Family, which is aimed at multimedia in mobile communications. Using this standard, the G.723.1 can be adapted to all wire and wireless transmission systems, although ANNEX C does not define a standard for functions that rely on transmission systems such as interleave or burst formatting systems. 1.5 System Outline 1.5.1 Features * Compression coding at 5.3 and 6.3 Kbps (variable bit rate for ANNEX C) * High bit-rate speech coding * Codes and decodes 240 samples/frames at an 8 kHz sampling frequency * All speech I/O data is 16-bit linear data 1.5.2 Operating environment (1) Target DSPs PD77018 PD77018A PD77019 PD77110 PD77111 PD77112 PD77113 PD77114 PD77116 (Under development) 12 User's Manual U13955EJ2V0UM00 CHAPTER 1 OUTLINE (2) Required memory Table 1-1. Required Memory Capacity Memory Instruction memory X memory - RAM Note Type ANNEX A [Word] 5.6 K 2.1 K 3.9 K 2.0 K 5.6 K ANNEX C [Word] 7.9 K 2.2 K 5.6 K 2.0 K 6.5 K ROM Y memory RAM Note ROM Note The scratch area within the RAM area is X: 1024 words, Y: 1024 words in ANNEX A, and X: 1108 words, Y: 284 words in ANNEX C. (3) Software tools (WindowsTM) DSP tools: WB77016 (Workbench) HSM77016 (High-speed simulator) 1.5.3 Performance [Conditions] DSP: PD77016 Family (33 MIPS when operating at 33 MHz) [Necessary MIPS value for execution of a 1-frame process in real-time (30 ms)] (G.723.1 ANNEX A) Compression processing: 17.5 MIPS Decompression processing: 1.5 MIPS (G.723.1 ANNEX C) Compression processing: +1 MIPS Decompression processing: +1.5 MIPS User's Manual U13955EJ2V0UM00 13 CHAPTER 1 OUTLINE 1.5.4 Directory configuration The directory configuration of this middleware is shown below. library g723_016.lib: g723_01x.lib: Library for the PD77110 and 77116 Library for the PD77018, 77018A, 77019, 77111, 77112, 77113, and 77114 sampleA.prj: sampleAC.prj: upd7701x.h: g723_lib.h: g723 C lib.h: sampleA.asm: Project file (for ANNEX A) Project file (for ANNEX C) Header file for PD77016 Family Library header file for ANNEX A Library header file for ANNEX C Sample source (for ANNEX A) smp g723 sampleAC.asm: Sample source (for ANNEX C) Library files g723_016.lib and g723_01x.lib are included in the following object file. Note that g723_016.lib cannot be used for the PD77016, and g723_01x.lib cannot be used for the PD77015 and 77017. * g723aenc.rel * g723adec.rel * g723acom.rel * g723cenc.rel * g723cdec.rel * g723ccom.rel (G.723.1 ANNEX A Encoder) (G.723.1 ANNEX A Decoder) (G.723.1 ANNEX A Encoder and Decoder shared section) (G.723.1 ANNEX C Encoder) (G.723.1 ANNEX C Decoder) (G.723.1 ANNEX C Encoder and Decoder shared section) 14 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS This chapter describes the function specifications and call conventions of this middleware. 2.1 G.723.1 Speech Codec Processing Flow The processing flow of applications that use this middleware is shown in Figures 2-1 and 2-2 below. Figure 2-1. Application Processing Flow (Encoder) Start Encoder initialization call G723_Ini_Coder Note (call G723_Ini_ChCod ) Voice I/O initialization process AD/DA initialization setting Interrupt permission Library entry specification 16 bits x 240 samples encoder data input process Encode process call G723_Encode Note (call G723_ChCod ) Encoder data output process Note "G723_Ini_ChCod" and "G723_ChCod" are functions for ANNEX C. used. Be sure to call and use G723_Ini_ChCod and G723_ChCod after G723_Ini_Coder and G723_Encode only when ANNEX C is User's Manual U13955EJ2V0UM00 15 CHAPTER 2 LIBRARY SPECIFICATIONS Figure 2-2. Application Processing Flow (Decoder) Start Decoder initialization Note (call G723_Ini_ChDec ) call G723_Ini_Decod Voice I/O initialization process AD/DA initialization setting Interrupt permission Library entry specification Decoder data input process Decode process Note (call G723_ChDec ) call G723_Decode 16 bits x 240 samples decoder data output process Note "G723_Ini_ChDec" and "G723_ChDec" are functions for ANNEX C. used. Be sure to call and use G723_Ini_ChDec and G723_ChDec before G723_Ini_Decode and G723_Decode only when ANNEX C is 16 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS 2.2 Function Specifications 2.2.1 Encoder initialization functions The encoder initialization functions set each encoder constant and initialize the coefficient table and the delay buffer. (1) Scratch area initialization function [Classification] [Function name] [Format] [Argument] [Return value] [Function] [Registers used] Scratch area initialization process G723_Start_Codec call G723_Start_Codec None None Clears the scratch area used by G.723.1 ANNEX A to 0. R0, DP0, DP4 Maximum stack level: Maximum loop stack level: Maximum number of repeat: Maximum number of cycles: 0 1 0 4000 [Function outline] Clears the scratch area used by G.723.1 ANNEX A to 0. [Hardware resource] User's Manual U13955EJ2V0UM00 17 CHAPTER 2 LIBRARY SPECIFICATIONS (2) Encoder for G.723.1 ANNEX A initialization function [Classification] [Function name] [Format] [Argument] Encoder initialization process G723_Ini_Coder call G723_Ini_Coder Top address of the X/Y static variable area Example r0l= StaticAreaX *IOArea+G723_STATIC_X_PTR:x = r0l r0l= StaticAreaY *IOArea+G723_STATIC_Y_PTR:x = r0l dp0=IOArea [Return value] [Function] [Registers used] None Initializes the G.723.1 ANNEX A encoder and sets the parameters. R0, R6, R7, DP0, DP4 Maximum stack level: Maximum loop stack level: Maximum number of repeat: Maximum number of cycles: 2 1 256 2000 ; ; ; ; ; [Function outline] Initializes the RAM area and sets the parameters used by G.723.1 ANNEX A encoder. [Hardware resource] 18 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS (3) Encoder for G.723.1 ANNEX C initialization function [Classification] [Function name] [Format] [Argument] Encoder initialization process G723_Ini_ChCod call G723_Ini_ChCod Top address of the I/O buffer and each set parameter Example clr(r0); /*...*/ *EncLineBuff+12:x = r0h; /*...*/ *EncLineBuff+13:x = r0h; /*---*/ dp0 = LibEntry; r0l = C_StaticAreaX; /*...*/ *dp0++ = r0l; r0l = C_StaticAreaY; /*...*/ *dp0++ = r0l; r0l = EncLineBuff; /*...*/ *dp0++ = r0l; r0l = EncChanBuff; /*...*/ *dp0++ = r0l; r0l = 1; /*...*/ *dp0++ = r0l; r0l = 1; /*...*/ *dp0++ = r0l; /* */ rep 6; /* */dp0++ = r0h /*---*/ dp0 = LibEntry; [Return value] [Function] [Registers used] None Initializes the G.723.1 ANNEX C encoder and sets the parameters. R0, DP0, DP1, DP4 Maximum stack level: Maximum loop stack level: Maximum number of repeat: Maximum number of cycles: 0 0 15 34 r0 = *dp4++; *dp0++ = r0h; // High/Low select (0:low 1:high) // number of octets(dummy access) /*---*/ dp4 = BitrateConfig; /* */ r0 = *dp4++; // EncodeSW (0:off 1:on) // Output buffer // Input buffer [Function outline] Initializes the RAM area and sets the parameters used by G.723.1 ANNEX C encoder. [Hardware resource] User's Manual U13955EJ2V0UM00 19 CHAPTER 2 LIBRARY SPECIFICATIONS 2.2.2 Decoder initialization functions The decoder initialization functions set each decoder constant and initialize the coefficient table and the delay buffer. (1) Decoder for G.723.1 ANNEX A initialization function [Classification] [Function name] [Format] [Argument] Decoder initialization process G723_Ini_Decod call G723_Ini_Decod Top address of the X/Y static variable area Example r0l= StaticAreaX *IOArea+G723_STATIC_X_PTR:x = r0l r0l= StaticAreaY *IOArea+G723_STATIC_Y_PTR:x = r0l dp0=IOArea [Return value] [Function] [Registers used] None Initializes the G.723.1 ANNEX A decoder and sets the parameters. R0, R1, R6, R7, DP0, DP4, DP5 Maximum stack level: Maximum loop stack level: Maximum number of repeat: Maximum number of cycles: 2 1 145 1000 ; ; ; ; ; [Function outline] Initializes the RAM area and sets the parameters used by G.723.1 ANNEX A decoder. [Hardware resource] 20 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS (2) Decoder for G.723.1 ANNEX C initialization function [Classification] [Function name] [Format] [Argument] Decoder initialization process G723_Ini_ChDec call G723_Ini_ChDec Top address of the I/O buffer and each set parameter Example clr(r0); /*---*/ dp0 = LibEntry + G723C_LIBENTRY_DECOFS; r0l = DecLineBuff; /*...*/ *dp0++ = r0l; r0l = DecChanBuff; /*...*/ *dp0++ = r0l; /* /* */ /* */ rep 6; /* */ [Return value] [Function] [Registers used] None Initializes the G.723.1 ANNEX C decoder and sets the parameters. R0, DP0, DP1, DP4 Maximum stack level: Maximum loop stack level: Maximum number of repeat: Maximum number of cycles: 0 0 15 34 *dp0++ = r0h r0 = *dp4++; /*---*/ dp0 = LibEntry; */ *dp0++ = r0h; *dp0++ = r0h; r0 = *dp4++; // Input buffer // clear error flag // reserved // Output buffer [Function outline] Initializes the RAM area and sets the parameters used by G.723.1 ANNEX C decoder. /*---*/ dp4 = BitrateConfig; [Hardware resource] User's Manual U13955EJ2V0UM00 21 CHAPTER 2 LIBRARY SPECIFICATIONS 2.2.3 Encoder functions Encoder functions generate the signals that compress the 240 items of sampled speech data that were input into 189, 159, or 32 bits. Note that in ANNEX C this is a variable rate. (1) Encoder function for G.723.1 ANNEX A [Classification] [Function name] [Format] [Argument] Encoder processing section G723_Encode call G723_Encode Top address of the I/O buffer and each set parameter Example r0l= EncPcmBuff *IOArea+G723_ENC_BUFF_PTR:x = r0l r0l= EncLineBuff *IOArea+G723_VOUT_PTR:x= r0l *IOArea+G723_USE_VAD:x= ??? *IOArea+G723_USE_HP:x= ??? *IOArea+G723_WRK_RATE_E:x= ??? dp0=IOArea [Return value] Frame type and number of clipped subframes Example ??? = *IOArea+G723_E_FRAME_TYPE:x ??? = *IOArea+G723_COUNT_CLIP:x Compressed data: output buffers set by arguments [Function] [Registers used] Compresses the input data from the codec (240 samples x 16 bits) into 189, 159, or 32 bits. R0, R1, R2, R3, R4, R5, R6, R7, DP0, DP1, DP2, DP3, DP4, DP5, DP6, DP7, DN0, DN1, DN2, DN3, DN4, DN5, DN6, DN7, DMX, DMY [Hardware resource] Maximum stack level: Maximum loop stack level: Maximum number of repeat: Maximum MIPS value: 7 4 256 17.5 ; set IO parameter ; ; ; ; 0)VAD off, 1)VAD on ; 0)Hpf off, 1)Hpf on ; 0)6.3kbps, 1)5.3kbps ; ; 0)NoTx ,1)Active ,2)SID ; clipped sub-frames 0..3 [Function outline] Compresses the 240 16-bit samples into 189, 159, or 32 bits 22 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS (2) Encoder function for G.723.1 ANNEX C [Classification] [Function name] [Format] [Argument] Encoder processing section G723_ChCod call G723_ChCod Top address of the I/O buffer and each set parameter Example clr(r0); /*...*/ *EncLineBuff+12:x = r0h; /*...*/ *EncLineBuff+13:x = r0h; /*---*/ dp0 = LibEntry; r0l = C_StaticAreaX; /*...*/ *dp0++ = r0l; r0l = C_StaticAreaY; /*...*/ *dp0++ = r0l; r0l = EncLineBuff; /*...*/ *dp0++ = r0l; r0l = EncChanBuff; /*...*/ *dp0++ = r0l; r0l = 1; /*...*/ *dp0++ = r0l; r0l = 1; /*...*/ *dp0++ = r0l; /* */ rep 6; /* */dp0++ = r0h /*---*/ dp0 = LibEntry; [Return value] [Function] [Registers used] Number of octets: r2l Compressed data: output buffers set by arguments Compresses the input data from the codec (240 samples x 16 bits) at a variable rate R0, R1, R2, R3, R4, R5, R6, R7, DP0, DP1, DP2, DP3, DP4, DP5, DP6, DP7, DN0, DN1, DN2, DN3, DN4, DN5, DN6, DN7, DMX, DMY [Hardware resource] Maximum stack level: Maximum loop stack level: Maximum number of repeat: Maximum MIPS value: 3 2 636 1.0 r0 = *dp4++; *dp0++ = r0h; // High/Low select (0:low 1:high) // number of octets(dummy access) /*---*/ dp4 = BitrateConfig; /* */ r0 = *dp4++; // EncodeSW (0:off 1:on) // Output buffer // Input buffer [Function outline] Channel codes the data that was compressed by G723_Encode User's Manual U13955EJ2V0UM00 23 CHAPTER 2 LIBRARY SPECIFICATIONS 2.2.4 Decoder functions Decoder functions decompress the signals that were compressed into 189, 159, or 32 bits back into 240 samples x 16 bits speech data. (1) Decoder function for G.723.1 ANNEX A [Classification] [Function name] [Format] [Argument] Decoder processing section G723_Decode call G723_Decode Top address of the I/O buffer and each set parameter Example r0l= DecPcmBuff ; set IO parameter *IOArea+G723_DEC_BUFF_PTR:x = r0l ; r0l= DecLineBuff *IOArea+G723_VINP_PTR:x= r0l *IOArea+G723_USE_PF:x= ??? *IOArea+G723_CRC_RESULT:x = ??? dp0=IOArea [Return value] Frame type, work rate, and number of error frames Example ???= *IOArea+G723_D_FRAME_TYPE:x ???= *IOArea+G723_WRK_RATE_D:x ???= *IOArea+ERR_FRM_COUNT:x Decompressed data: output buffers set by arguments [Function] [Registers used] Decompresses the data that was compressed into 189, 159, or 32 bits back into speech data (240 samples x 16 bits) R0, R1, R2, R3, R4, R5, R6, R7, DP0, DP1, DP2, DP3, DP4, DP5, DP6, DP7, DN0, DN1, DN2, DN3, DN4, DN5, DN6, DN7, DMX [Hardware resource] Maximum stack level: Maximum loop stack level: Maximum number of repeat: Maximum MIPS value: 4 3 240 1.5 ; ; ; 0)Psf off, 1)Psf on ;CRC_result,0)Normal,else)Err ; ; 0)NoTx ,1)Active ,2)SID ; 0)6.3kbps, 1)5.3kbps ; Num of Error frame 0..0x7ff [Function outline] Decompresses the 189, 159, or 32 bits back into 240 16-bit samples 24 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS (2) Decoder function for G.723.1 ANNEX C [Classification] [Function name] [Format] [Argument] Decoder process section G723_ChDec call G723_ChDec Top address of the I/O buffer and each set parameter Example clr(r0); /*---*/ dp0 = LibEntry + G723C_LIBENTRY_DECOFS; r0l = DecLineBuff; /*...*/ *dp0++ = r0l; r0l = DecChanBuff; /*...*/ *dp0++ = r0l; /* /* */ /* */ rep 6; /* */ [Return value] *dp0++ = r0h r0 = *dp4++; /*---*/ dp0 = LibEntry; mode (0: 6.3 K, 1: 5.3 K, 2: SID): r0l Final address of bit stream + 1: r1l Decompressed data: output buffers set by arguments [Function] [Registers used] Decompresses the data that was compressed by a variable rate back into speech data (240 samples x 16 bits) R0, R1, R2, R3, R4, R5, R6, R7, DP0, DP1, DP2, DP3, DP4, DP5, DP6, DP7, DN0, DN1, DN2, DN3, DN4, DN5, DN6, DN7, DMX [Hardware resource] Maximum stack level: Maximum loop stack level: Maximum number of repeat: Maximum MIPS value: 4 3 15 1.5 */ *dp0++ = r0h; *dp0++ = r0h; r0 = *dp4++; /*---*/ dp4 = BitrateConfig; // reserved // Input buffer // clear error flag // Output buffer [Function outline] Performs channel decoding, and creates the code that extracts the G723_Decode function User's Manual U13955EJ2V0UM00 25 CHAPTER 2 LIBRARY SPECIFICATIONS 2.2.5 Version acquisition function The version acquisition function returns the version of the library. [Classification] [Function name] [Format] [Argument] [Return value] [Function] Version information acquisition G723_GetVersion call G723_GetVersion None R0H R0L Major version number Minor version number [Function outline] Restores the version of the library Returns the version number of this middleware with a 32-bit value. Example If R0 = 0x00'0x0001'0x0100 then Version: V1.01 [Registers used] R0 26 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS 2.3 Description of External Interface The parameters that extract functions G723_Encode and G723_Decode for G.723.1 ANNEX A, and functions G723_ChCod and G723_ChDec for G.723.1 ANNEX C at the time that each function is called are described here. 2.3.1 Extraction parameters for G.723.1 ANNEX A functions Secure scratch areas as follows. Scratch areas X and Y require "align at 0x20". * Scratch area X: 1024-word area labeled as "lib_Scratch _x" in the X memory * Scratch area Y: 1024-word area labeled as "lib_Scratch _y" in the Y memory Secure static areas as follows. Static area X requires "align at 0x20" and static area Y requires "align at 0x200". * Make the address of "lib_Scratch _x" the same as that of "lib_Scratch _y". Table 2-1. Extraction Parameters for G.723.1 ANNEX A Functions Function Classification Symbol Note 6 (Offset Address) Setting Value Encoder/Decoder Shared Parameters Static X memory area Static Y memory area Encoder Parameters Encoder input buffer Encoder output buffer Coding bit rate VAD control Preprocessing HPF control Encode frame type Number of clipped frames Decoder Parameters Decoder output buffer Decoder input buffer Postprocessing filter control CRC flag Decode frame type Decode bit rate Frame error count Control input Control input Control input Control input Status output Status output Status output Note 4 Note 3 Control input Control input Note 1 G723_STATIC_X_PTR G723_STATIC_Y_PTR X memory addresses Y memory addresses Note 1 Control input Control input Control input Control input Control input Note 2 G723_ENC_BUFF_PTR G723_VOUT_PTR G723_WRK_RATE_E G723_USE_VAD G723_USE_HP G723_E_FRAME_TYPE G723_COUNT_CLIP X memory addresses X memory addresses 0: 6.3 Kbps, 1: 5.3 Kbps 0: VAD OFF, 1: VAD ON 0: HPF OFF, 1: HPF ON 0: No transfer, 1: Active, 2: SID 0 to 3 Note 2 Status output Status output G723_DEC_BUFF_PTR G723_VINP_PTR G723_USE_PF G723_CRC_RESULT G723_D_FRAME_TYPE G723_WRK_RATE_D G723_ERR_FRM_COUNT X memory addresses X memory addresses 0: Filter OFF, 1: Filter ON 0: Normal, else: Error 0: No transfer, 1: Active, 2: SID 0: 6.3 Kbps, 1: 5.3 Kbps 0 to 0x7FFF Note 5 Notes 1. 2. 3. 4. 5. 6. Cannot be changed following G723_Start_Codec. Cannot be changed during encoding. Cannot be changed during decoding. Valid only when there are active frames. Reset to 0 if normal frame acknowledged. Symbols show the value offset from the value of DP0 when each function is called. User's Manual U13955EJ2V0UM00 27 CHAPTER 2 LIBRARY SPECIFICATIONS 2.3.2 Extraction parameters for G.723.1 ANNEX C functions Secure scratch areas as follows. Scratch areas X and Y require "align at 0x20". * Scratch area X: 1108-word area labeled as "lib_Scratch _x" in the X memory * Scratch area Y: 1024-word area labeled as "lib_Scratch _y" in the Y memory Secure a scratch area consistent with whichever is larger: ANNEX A or ANNEX C (x indicates ANNEX C and y indicates ANNEX A). Table 2-2. Extraction Parameters for G.723.1 ANNEX C Functions (1/2) Function Encoder/Decoder Shared Parameters Static X memory area Static Y memory area Encoder Parameters Encoder input buffer Encoder output buffer Coding drive control High-level/low-level switch Coding result data size Channel upper rate when coding at 6.3 Kbps Channel lower rate when coding at 6.3 Kbps Channel upper rate when coding at 5.3 Kbps Channel lower rate when coding at 5.3 Kbps Channel upper rate when coding at SID Channel lower rate when coding at SID Control input Control input Control input Control input Control input Control input Note 3 Note 2 Classification Symbol Note 4 (Offset Address) Setting Value Control input Control input Note 1 G723C_LibStatic_X G723C_LibStatic_Y X memory addresses Y memory addresses Note 1 G723C_LibEncInBuffer G723C_LibEncOutBuffer G723C_LibEncoderSW G723C_LibEncHighLow G723C_LibEncOutSize G723C_LibEncULim63 X memory addresses X memory addresses 0: OFF, 1: ON 0: Low-level, 1: High-level Number of bits Number of bps Control input Note 3 G723C_LibEncLLim63 Number of bps Control input Note 3 G723C_LibEncULim53 Number of bps Control input Note 3 G723C_LibEncLLim53 Number of bps Control input Note 3 G723C_LibEncULimSID Number of bps Control input Note 3 G723C_LibEncLLimSID Number of bps Notes 1. 2. 3. Cannot be changed following G723_Start_Codec. The high-level/low-level switch is common to 6.3 Kbps, 5.3 Kbps, and SID. The values set for the upper and lower channel rate limits must be within the following range when encoding/decoding: For 6.3 Kbps: Above 7034 and below 20634 For 5.3 Kbps: Above 6000 and below 17534 For SID: Above 1600 and below 4334 4. Symbols show the value offset from the value of DP0 when each function is called. 28 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS Table 2-2. Extraction Parameters for G.723.1 ANNEX C Functions (2/2) Function Decoder Parameters Decoder output buffer Decoder input buffer Decode result error display Reserved Channel upper rate when decoding at 6.3 Kbps Channel lower rate when decoding at 6.3 Kbps Channel upper rate when decoding at 5.3 Kbps Channel lower rate when decoding at 5.3 Kbps Channel upper rate when decoding at SID Channel lower rate when decoding at SID Control input Control input Status output - Control input Note 2 Note 1 Classification Symbol Note 3 (Offset Address) Setting Value G723C_LibDecOutBuffer G723C_LibDecInBuffer G723C_LibDecErrorInfo G723C_LibDecReserved G723C_LibDecULim63 X memory addresses X memory addresses Bit 2: FII, Bit 1: EFI, Bit 0: BFI - Number of bps Control input Note 2 G723C_LibDecLLim63 Number of bps Control input Note 2 G723C_LibDecULim53 Number of bps Control input Note 2 G723C_LibDecLLim53 Number of bps Control input Note 2 G723C_LibDecULimSID Number of bps Control input Note 2 G723C_LibDecLLimSID Number of bps Notes 1. When decoding, input the value from the decode result error display as the CRC value of the code data for decoding. The decoding processing of the frames that correspond to this error display is the frame compensation process. 2. The values set for the upper and lower channel rate limits must be within the following range when encoding/decoding: For 6.3 Kbps: Above 7034 and below 20634 For 5.3 Kbps: Above 6000 and below 17534 For SID: Above 1600 and below 4334 3. Symbols show the value offset from the value of DP0 when each function is called. User's Manual U13955EJ2V0UM00 29 CHAPTER 2 LIBRARY SPECIFICATIONS 2.4 I/O Data Format The I/O data format of the ITU-T-recommended G.723.1 is outlined here. 2.4.1 Encoder input/decoder output data format Input the encoder-input data, which is PCM data that has been sampled at 8 kHz, in a 16-bit x 240-sample format. The decoder output data is output in the form of 16-bit x 240-sample PCM data that has been sampled at 8 kHz. 2.4.2 Encoder output/decoder input data format The format of compressed data for encoder output and decoder input is as follows. Figure 2-3. Compressed Data Frame Format Octet#2 Octet#4 Octet#1 Octet#3 Octet#2n Octet#2n-1 Remark 2n: Frame byte number. Table 2-3. Bit Rate and Frame Byte Number of G.723.1 ANNEX A Compressed Data Bit Rate 6.3 Kbps 5.3 Kbps SID Frame Byte Number 24 20 4 Table 2-4. Bit Rate and Frame Byte Number of G.723.1 ANNEX C Compressed Data Bit Rate 6.3 Kbps 5.3 Kbps SID Frame Byte Number 27 to 78 23 to 66 6 to 17 30 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS (1) Compression format of active frame data The formats of the 6.3 Kbps speech compression data (189-bit data) and the 5.3 Kbps speech compression data (159-bit data), which are the encoder function output and decoder function input respectively, are shown in Tables 2-5 and 2-6 below. Refer to ITU-T Recommendations for compression data details. Table 2-5. 6.3 Kbps Speech Compression Data Format TRANSMITTED OCTETS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 PARx_By, ..., ... LPC_B5 to LPC_B0, VADFLAG_B0, RATEFLAG_B0 LPC_B13 to LPC_B6 LPC_B21 to LPC_B14 ACL0_B5 to ACL0_B0, LPC_B23, LPC_B22 ACL2_B4 to ACL2_B0, ACL1_B1, ACL1_B0, ACL0_B6 GAIN0_B3 to GAIN0_B0, ACL3_B1, ACL3_B0, ACL2_B6, ACL2_B5 GAIN0_B11 to GAIN0_B4 GAIN1_B7 to GAIN1_B0 GAIN2_B3 to GAIN2_B0, GAIN1_B11 to GAIN1_B8 GAIN2_B11 to GAIN2_B4 GAIN3_B7 to GAIN3_B0 GRID3_B0, GRID2_B0, GRID1_B0, GRID0_B0, GAIN3_B11 to GAIN3_B8 MSBPOS_B6 to MSBPOS_B0, UB Note POS0_B1, POS0_B0, MSBPOS_B12 to MSBPOS_B7 POS0_B9 to POS0_B2 POS1_B2, POS1_B0, POS0_B15 to POS0_B10 POS1_B10, POS1_B3 POS2_B3 to POS2_B0, POS1_B13 to POS1_B11 POS2_B11 to POS2_B4 POS3_B3 to POS3_B0, POS2_B15 to POS2_B12 POS3_B11 to POS3_B4 PSIG0_B5 to PSIG0_B0, POS3_B13, POS3_B12 PSIG2_B2 to PSIG2_B0, PSIG1_B4 to PSIG1_B0 PSIG3_B4 to PSIG3_B0, PSIG2_B5 to PSIG2_B3 Note UB designates an unused bit (value 0). User's Manual U13955EJ2V0UM00 31 CHAPTER 2 LIBRARY SPECIFICATIONS Table 2-6. 5.3 Kbps Speech Compression Data Format TRANSMITTED OCTETS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 PARx_By, ..., ... LPC_B5 to LPC_B0, VADFLAG_B0, RATEFLAG_B0 LPC_B13 to LPC_B6 LPC_B21 to LPC_B14 ACL0_B5 to ACL0_B0, LPC_B23, LPC_B22 ACL2_B4 to ACL2_B0, ACL1_B1, ACL1_B0, ACL0_B6 GAIN0_B3 to GAIN0_B0, ACL3_B1, ACL3_B0, ACL2_B6, ACL2_B5 GAIN0_B11 to GAIN0_B4 GAIN1_B7 to GAIN1_B0 GAIN2_B3 to GAIN2_B0, GAIN1_B11 to GAIN1_B8 GAIN2_B11 to GAIN2_B4 GAIN3_B7 to GAIN3_B0 GRID3_B0, GRID2_B0, GRID1_B0, GRID0_B0, GAIN3_B11 to GAIN3_B8 POS0_B7 to POS0_B0 POS1_B3 to POS1_B0, POS0_B11 to POS0_B8 POS1_B11 to POS1_B4 POS2_B7 to POS2_B0 POS3_B3 to POS3_B0, POS2_B11 to POS2_B8 POS3_B11 to POS3_B4 PSIG1_B3 to PSIG1_B0, PSG0_B3 to PSG0_B0 PSIG3_B3 to PSIG3_B0, PSIG2_B3 to PSIG2_B0 32 User's Manual U13955EJ2V0UM00 CHAPTER 2 LIBRARY SPECIFICATIONS (2) SID frame compression format The format of the 32-bit inactive frame data, which is the encoder function output and decoder function input, is shown in Table 2-7 below. Refer to ITU-T Recommendations for compressed data details. Note, however, that "0x3" is returned to "TRANSMITTED OCTETS = 1" and "0x0" to "TRANSMITTED OCTETS = 2 to 4" when G723_E_FRAME_TYPE = 0 or G723_D_FRAME_TYPE = 0. Table 2-7. Bit Allocation of SID Data TRANSMITTED OCTETS 1 2 3 4 PARx_By, ... LPC_B5 to LPC_B0, VADFLAG_B0, RATEFLAG_B0 LPC_B13 to LPC_B6 LPC_B21 to LPC_B14 GAIN_B5 to GAIN_B0, LPC_B23, LPC_B22 (3) G.723.1 ANNEX C (channel codec) additional compression data format The format of ANNEX C data, which is the encoder function output and decoder function input, is shown in Table 2-8 below. Refer to ITU-T Recommendations for compressed data details. Table 2-8. Bit Allocation of ANNEX C Compression Data TRANSMITTED OCTETS 1 2 3 Mp/8 + 2 : MAll/8 + 2 Channel Bit UCB[7], UCB[6], UCB[5], UCB[4] , UCB[3], UCB[2], UCB[1], UCB[0] U[2], U[1], U[0], UCB[12], UCB[11], UCB[10], UCB[9] ,UCB[8] U[10], U[9], U[8], U[7], U[6], U[5], U[4], U[3] ..., ..., U[Mp], U[Mp-1], U[Mp-2], ..., ..., ... : UB, UB ,UB, U[MAll-1], U[MAll-2], U[MAll-3], U[MAll-4], U[MAll-5] Remark UB designates an unused bit (value 0). The bit rate of a protected bit string is (MAII + 13) x 1000/30 bps. User's Manual U13955EJ2V0UM00 33 [MEMO] 34 User's Manual U13955EJ2V0UM00 CHAPTER 3 INSTALLATION 3.1 Installation Procedure This middleware is only offered in a 3.5-inch (1.44 MB) floppy disk format. The procedure for installing this disk in the host machine is as follows. (1) Set this disk in the floppy disk drive. Copy the file under a directory that uses software tools (C:\DSPTools, for example). An example of when the file was copied from A drive to C drive is shown below. a:\>xcopy /s *.* c:\DSPTools 3.2 Sample Creation Procedure The sample program is installed in the sample directory (refer to APPENDIX SAMPLE PROGRAM SOURCE for details of the sampleA.asm and sampleAC.asm source programs). The sample program is able to connect speech sources such as CDs and DATs with speakers, and compress/decompress the speech source in real time. Figure 3-1. Sample Program Evaluation System Speaker Speech source Evaluation board LINE output DSP LINE input Codec User's Manual U13955EJ2V0UM00 35 CHAPTER 3 INSTALLATION The following is an example of how to build a sample program for this middleware. (1) Activate the WB77016 (workbench). (2) Open the sampleA.prj (sampleAC.prj) project file. Example Specify sampleA.prj (sampleAC.prj) with the Open Project command from the Project menu. (3) Execute the build function and check that sampleA.lnk (sampleAC.lnk) has been created. Example When the Build All command is selected from the Make menu, the sampleA.lnk (sampleAC.lnk) file is created. (4) Download the program to the evaluation board. 3.3 Symbol Naming Conventions The symbols, etc., in this library are allocated names in accordance with the conventions outlined below. Be careful not to duplicate these names when this middleware is being used in combination with other applications. Table 3-1. Symbol Names Classification G.723.1 ANNEX A Function name Macro, constant name Section name G723_xxxx G723_xxxx _ _ G723_xxxx _ _ G723_Cxxxx Convention G.723.1 ANNEX C G723_Chxxxx 36 User's Manual U13955EJ2V0UM00 APPENDIX SAMPLE PROGRAM SOURCE A.1 For G.723.1 + ANNEX A (sampleA.asm) /*----------------------------------------------------------------------------/* File Information /*----------------------------------------------------------------------------/* Name : sampleA.asm /* Type : ASM Programming Language source code /* Version : V1.00 /* Date : 1998 June 10 /* CPU : uPD7701x Family /* Assembler : WB77016 Ver2.21 /* About : NEC uPD7701x Family G723.1 Speech CODEC Middle-Ware Library /* Sample program [1ch, OFF-LINE mode] /*----------------------------------------------------------------------------/* Copyright (c) NEC Corporation 1995,1996,1997,1998 /* NEC CONFIDENTIAL AND PROPRIETAR /* All rights reserved by NEC Coporation /* Use of copyright notice does not evidence publication /*----------------------------------------------------------------------------/*---- include files ----*/ #include "uPD77016.h" #include "g723_lib.h" /*---- Global Variables ----*/ public lib_Scratch_x public lib_Scratch_y /*---- Global Functions ----*/ extrn G723_GetVersion extrn G723_Start_Codec extrn G723_Ini_Coder extrn G723_Ini_Decod extrn G723_Encode extrn G723_Decode */ */ */ */ */ */ */ */ */ */ */ */ */ */ */ */ */ /* Scrach area X */ /* Scrach area Y */ /* /* /* /* /* /* Get Version function */ Start G723 functions */ Initialize G723 Coder variables */ Initialize G723 Decoder variables */ Encode 1 Frame */ Decode 1 Frame */ $EJECT /**/ /*****************************************************************************/ /* Vector Table */ /*****************************************************************************/ Vct_Ix imseg at 0x0200 call Init_Proc ; reset jmp G723_Proc ; nop ; nop ; reti ; not used nop ; nop ; nop ; reti ; not used nop ; User's Manual U13955EJ2V0UM00 37 APPENDIX SAMPLE PROGRAM SOURCE nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; not used INT0 INT1 INT2 INT3 SI#1 SO#1 SI#2 SO#2 HOST IN HOST OUT not used not used 38 User's Manual U13955EJ2V0UM00 APPENDIX SAMPLE PROGRAM SOURCE /*****************************************************************************/ /* G723 OFF-Line Process */ /*****************************************************************************/ Smp_Ix imseg Init_Proc: clr(r0) ; No Wait *DWTR:x = r0l ; *IWTR:x = r0l ; r0l = HST_WAIT *HST:x = r0l ret ; Wait mode ; ; $EJECT /**/ /*----------------------------------------------------------------------------/* Scratch_Area / Static_Area / IO_Buffer /* !!! 'lib_Scratch_x' must be equal to 'lib_Scratch_y' !!! /*----------------------------------------------------------------------------Scratch_X xramseg align at 0x020 lib_Scratch_x: ds G723_SCRATCH_X_BUFSIZE Scratch_Y yramseg align at 0x020 lib_Scratch_y: ds G723_SCRATCH_Y_BUFSIZE Static_X xramseg align at 0x020 StaticAreaX: ds G723_STATIC_X_BUFSIZE Static_Y yramseg align at 0x200 StaticAreaY: ds G723_STATIC_Y_BUFSIZE IO_Area_X xramseg IOArea: ds G723_IOTABLE_SIZE IO_Buff_X xramseg EncPcmBuff: ds DecPcmBuff: ds EncLineBuff: ds DecLineBuff: ds */ */ */ */ G723_FRAME G723_FRAME 24/2 24/2 /*----------------------------------------------------------------------------- */ /* Variables */ /*----------------------------------------------------------------------------- */ Smp_Xe1 xramseg WrkMode: ds 1 User's Manual U13955EJ2V0UM00 39 APPENDIX SAMPLE PROGRAM SOURCE /*****************************************************************************/ /* G723 OFF-Line Process */ /*****************************************************************************/ Smp_Ix imseg G723_Proc: call G723_Start_Codec ; Need only for Simulation test r0l = *HDT:x *WrkMode:x = r0l ;; ;; ;; call G723_GetVersion *HDT:x = r0h *HDT:x = r0l r0l = StaticAreaX *IOArea+G723_STATIC_X_PTR:x = r0l r0l = StaticAreaY *IOArea+G723_STATIC_Y_PTR:x = r0l r0l = EncPcmBuff *IOArea+G723_ENC_BUFF_PTR:x = r0l r0l = EncLineBuff *IOArea+G723_VOUT_PTR:x= r0l r0l = *HDT:x *IOArea+G723_USE_HP:x= r0l r0l = *HDT:x *IOArea+G723_USE_VAD:x= r0l r0l = DecPcmBuff *IOArea+G723_DEC_BUFF_PTR:x = r0l r0l = DecLineBuff *IOArea+G723_VINP_PTR:x = r0l r0l = *HDT:x *IOArea+G723_USE_PF:x= r0l r0l = *WrkMode:x r0 = r0 & 0x0001 if( r0==0 ) jmp INI_LBC_DEC /*---*/ dp0 = IOArea call G723_Ini_Coder jmp LBC_LOOP INI_LBC_DEC: /*---*/ dp0 = IOArea call G723_Ini_Decod LBC_LOOP: r0 = *HDT:x if( r0==0 ) jmp ; WrkMode 1)Cod ,2)Dec ; ; Library Version ; comment_out for ; Simulator Test ; ; Static Area X ; ; Static Area Y ; ; ; ; ; ; ; ; PCM Buffer for Encode Code Buffer for Encode UseHp 0)No , 1)UseHp UseVAD 0)No , 1)UseHp ; ; PCM buffer for Decode ; ; Code buffer for Decode ; ; UsePf 0)No , 1)UsePf ; ; ; ; ; ; ; ; LBC_END ; Control 0)Stop, 1)Continue ; ; ; ; ; ; ; WrkRate 0)6.3, 1)5.3 [kbps] r0l = *WrkMode:x r0 = r0 & 0x0001 if( r0==0 ) jmp LBC_DEC call GetPcmData r0l = *HDT:x *IOArea+G723_WRK_RATE_E:x = r0l 40 User's Manual U13955EJ2V0UM00 APPENDIX SAMPLE PROGRAM SOURCE /*---*/ dp0 = IOArea call G723_Encode call PutLineData r0l = *IOArea+G723_E_FRAME_TYPE:x *HDT:x = r0l jmp LBC_NEXT LBC_DEC: r0l = *WrkMode:x r0 = r0 & 0x0002 if( r0==0 ) jmp LBC_NEXT call GetLineData r0l = *HDT:x *IOArea+G723_CRC_RESULT:x = r0l /*---*/ dp0 = IOArea call G723_Decode call PutPcmData r0l = *IOArea+G723_D_FRAME_TYPE:x *HDT:x = r0l r0l = *IOArea+G723_WRK_RATE_D:x *HDT:x = r0l r0l = *IOArea+G723_ERR_FRM_COUNT:x *HDT:x = r0l LBC_NEXT: jmp LBC_END: jmp ; ; ; ; comment_out for ; Simulator Test ; ;; ;; ; ; ; ; ; ; CRC_result 0)Normal, else)Err ; ; ; ; comment_out for ; Simulator Test ; ; ; ; ;; ;; ;; ;; ;; ;; LBC_LOOP ; $ ; $EJECT /**/ /*****************************************************************************/ /* Input PCM data for Encode process */ /*****************************************************************************/ Smp_Ix imseg GetPcmData: /*---*/ dp0 = EncPcmBuff ; loop G723_FRAME { ; r0l = *HDT:x ; /* */ *dp0++ = r0l ; } ret ; /*****************************************************************************/ /* Output decoded PCM data */ /*****************************************************************************/ Smp_Ix imseg PutPcmData: /*---*/ dp0 = DecPcmBuff ; loop G723_FRAME { ; /* */ r0l = *dp0++ ; User's Manual U13955EJ2V0UM00 41 APPENDIX SAMPLE PROGRAM SOURCE *HDT: = r0l } ret ; ; /*****************************************************************************/ /* Input Code data for Decode process */ /*****************************************************************************/ Smp_Ix imseg GetLineData: /*---*/ dp0 = DecLineBuff ; loop 24/2 { ; r0l = *HDT:x ; /* */ *dp0++ = r0l ; } ret ; /*****************************************************************************/ /* Output Encoded Code data */ /*****************************************************************************/ Smp_Ix imseg PutLineData: /*---*/ dp0 = EncLineBuff ; loop 24/2 { ; /* */ r0l = *dp0++ ; *HDT:x = r0l ; } ret ; end 42 User's Manual U13955EJ2V0UM00 APPENDIX SAMPLE PROGRAM SOURCE A.2 For G.723.1 + ANNEX A + ANNEX C (sampleAC.asm) /*----------------------------------------------------------------------------/* File Information /*----------------------------------------------------------------------------/* Name : sampleAC.asm /* Type : ASM Programming Language source code /* Version : V1.00 /* Date : 1998 Oct 10 /* CPU : uPD7701x Family /* Assembler : WB77016 Ver2.21 /* About : NEC uPD7701x Family G723.1 Speech CODEC Middle-Ware Library /* Sample program [1ch, OFF-LINE mode] /*----------------------------------------------------------------------------/* Copyright (c) NEC Corporation 1995,1996,1997,1998 /* NEC CONFIDENTIAL AND PROPRIETARY /* All rights reserved by NEC Coporation /* Use of copyright notice does not evidence publication /*----------------------------------------------------------------------------/*---- include files ----*/ #include "uPD77016.h" #include "g723_lib.h" #include "g723clib.h" /*---- Global Variables ----*/ public lib_Scratch_x public lib_Scratch_y /*---- Global Functions ----*/ extrn G723_GetVersion extrn G723_Start_Codec extrn G723_Ini_Coder extrn G723_Ini_Decod extrn G723_Encode extrn G723_Decode */ */ */ */ */ */ */ */ */ */ */ */ */ */ */ */ */ /* Scrach area X */ /* Scrach area Y */ /* /* /* /* /* /* Get Version function */ Start G723 functions */ Initialize G723 Coder variables*/ Initialize G723 Decoder variables */ Encode 1 Frame*/ Decode 1 Frame*/ $EJECT /**/ /*****************************************************************************/ /* Vector Table */ /*****************************************************************************/ Vct_Ix imseg at 0x0200 call Init_Proc ; reset jmp G723_Proc ; nop ; nop ; reti ; not used nop ; nop ; nop ; reti ; not used nop ; nop ; nop ; reti ; not used User's Manual U13955EJ2V0UM00 43 APPENDIX SAMPLE PROGRAM SOURCE nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop reti nop nop nop ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; INT0 INT1 INT2 INT3 SI#1 SO#1 SI#2 SO#2 HOST IN HOST OUT not used not used /*****************************************************************************/ /* G723 OFF-Line Process */ /*****************************************************************************/ Smp_Ix imseg 44 User's Manual U13955EJ2V0UM00 APPENDIX SAMPLE PROGRAM SOURCE Init_Proc: clr(r0) *DWTR:x = r0l *IWTR:x = r0l r0l = HST_WAIT *HST:x = r0l ret ; No Wait ; ; ; Wait mode ; ; $EJECT /**/ /*----------------------------------------------------------------------------- */ /* Scratch_Area / Static_Area / IO_Buffer */ /* !!! 'lib_Scratch_x' must be equal to 'lib_Scratch_y' !!! */ /*----------------------------------------------------------------------------- */ Scratch_X xramseg align at 0x020 lib_Scratch_x: ;; ds G723_SCRATCH_X_BUFSIZE ds G723C_SCRATCH_X_BUFSIZE ; is bigger than G723_SCRATCH_X_BUFSIZE Scratch_Y yramseg align at 0x020 lib_Scratch_y: ds G723_SCRATCH_Y_BUFSIZE Static_X xramseg align at 0x020 StaticAreaX: ds G723_STATIC_X_BUFSIZE C_StaticAreaX: ds G723C_STATIC_X_BUFSIZE Static_Y yramseg align at 0x200 StaticAreaY: ds G723_STATIC_Y_BUFSIZE C_StaticAreaY: ds G723C_STATIC_Y_BUFSIZE IO_Area_X xramseg IOArea: ds G723_IOTABLE_SIZE LibEntry: ds G723C_LIBENTRY_SIZE IO_Buff_X xramseg EncPcmBuff: ds G723_FRAME DecPcmBuff: ds G723_FRAME EncLineBuff: ds 24/2 + 2 DecLineBuff: ds 24/2 + 1 EncChanBuff: DecChanBuff: ds ds 48 48 ; Annex C ; Annex C ; Annex C ; Annex C ; Annex C /*----------------------------------------------------------------------------- */ /* Variables */ /*----------------------------------------------------------------------------- */ Smp_Xe1 xramseg WrkMode: User's Manual U13955EJ2V0UM00 45 APPENDIX SAMPLE PROGRAM SOURCE ds 1 /*------------------------------------------------------------*/ /* Annex C initialization */ /*------------------------------------------------------------*/ AnnexC_Const yramseg BitrateConfig: dw 77, 27, 65, 23, 16, 6 /* Channel rate limits */ InitC imseg InitAnnexC: clr(r0); /*...*/ /*...*/ *EncLineBuff+12:x = r0h; *EncLineBuff+13:x = r0h; /*---*/ dp0 = LibEntry; r0l = C_StaticAreaX; /*...*/ *dp0++ = r0l; r0l = C_StaticAreaY; /*...*/ *dp0++ = r0l; r0l = EncLineBuff; /*...*/ *dp0++ = r0l; r0l = EncChanBuff; /*...*/ *dp0++ = r0l; r0l = 1; /*...*/ *dp0++ = r0l; r0l = 1; /*...*/ *dp0++ = r0l; /*---*/ dp4 = BitrateConfig; /* */ *dp0++ = r0h; /* */ r0 = *dp4++; rep 6; /* */ *dp0++ = r0h /*---*/ dp0 = LibEntry; call G723_Ini_ChCod; // Input buffer // Output buffer // EncodeSW (0:off 1:on) // High/Low select (0:low 1:high) // number of octets(dummy access) r0 = *dp4++; clr(r0); /*---*/ dp0 = LibEntry + G723C_LIBENTRY_DECOFS; r0l = DecLineBuff; /*...*/ *dp0++ = r0l; // r0l = DecChanBuff; /*...*/ *dp0++ = r0l; // /* */ *dp0++ = r0h; // /*---*/ dp4 = BitrateConfig; /* */ *dp0++ = r0h; // /* */ r0 = *dp4++; rep 6; /* */ *dp0++ = r0h r0 = *dp4++; /*---*/ dp0 = LibEntry; call G723_Ini_ChDec; ret; Output buffer Input buffer clear error flag reserved 46 User's Manual U13955EJ2V0UM00 APPENDIX SAMPLE PROGRAM SOURCE /*****************************************************************************/ /* G723 OFF-Line Process */ /*****************************************************************************/ Smp_Ix imseg G723_Proc: call G723_Start_Codec ; Need only for Simulation test r0l = *HDT:x *WrkMode:x = r0l ;; ;; ;; call G723_GetVersion *HDT:x = r0h *HDT:x = r0l r0l = StaticAreaX *IOArea+G723_STATIC_X_PTR:x = r0l r0l = StaticAreaY *IOArea+G723_STATIC_Y_PTR:x = r0l r0l = EncPcmBuff *IOArea+G723_ENC_BUFF_PTR:x = r0l r0l = EncLineBuff *IOArea+G723_VOUT_PTR:x = r0l r0l = *HDT:x *IOArea+G723_USE_HP:x = r0l r0l = *HDT:x *IOArea+G723_USE_VAD:x= r0l r0l = DecPcmBuff *IOArea+G723_DEC_BUFF_PTR:x = r0l r0l = DecLineBuff *IOArea+G723_VINP_PTR:x = r0l r0l = *HDT:x *IOArea+G723_USE_PF:x = r0l ; WrkMode 1)Cod ,2)Dec ; ; Library Version ; comment_out for ; Simulator Test ; ; Static Area X ; ; Static Area Y ; ; ; ; ; ; ; ; PCM Buffer for Encode Code Buffer for Encode UseHp 0)No , 1)UseHp UseVAD 0)No , 1)UseHp ; ; PCM buffer for Decode ; ; Code buffer for Decode ; ; UsePf 0)No , 1)UsePf ;; Setup Lib-Entry for Annex C call InitAnnexC; r0l = *WrkMode:x r0 = r0 & 0x0001 if( r0==0 ) jmp INI_LBC_DEC /*---*/ dp0 = IOArea call G723_Ini_Coder jmp LBC_LOOP INI_LBC_DEC: /*---*/ dp0 = IOArea call G723_Ini_Decod LBC_LOOP: r0 = *HDT:x if( r0==0 ) jmp LBC_END r0l = *WrkMode:x r0 = r0 & 0x0001 if( r0==0 ) jmp LBC_DEC ; ; ; ; ; ; ; ; ; Control 0)Stop, 1)Continue ; ; ; ; User's Manual U13955EJ2V0UM00 47 APPENDIX SAMPLE PROGRAM SOURCE call GetPcmData r0l = *HDT:x *IOArea+G723_WRK_RATE_E:x = r0l /*---*/ dp0 = IOArea call G723_Encode /*---*/ dp0 = LibEntry call G723_ChCod ; call PutLineData call PutChannelData; r0l = *IOArea+G723_E_FRAME_TYPE:x *HDT:x = r0l jmp LBC_NEXT LBC_DEC: r0l = *WrkMode:x r0 = r0 & 0x0002 if( r0==0 ) jmp LBC_NEXT call GetLineData call GetChannelData /*---*/ dp0 = LibEntry call G723_ChDec ; ; ; ; WrkRate 0)6.3, 1)5.3 [kbps] ; ; ; Annex C ; ; comment for Annex C ;; ;; ; comment_out for ; Simulator Test ; ; ; ; ; ; ; ; Annex C ; r0l = *HDT:x ; r0l = *(LibEntry + G723C_LIBENTRY_ERRINFO):x; *IOArea+G723_CRC_RESULT:x = r0l ; CRC_result 0)Normal, else)Err /*---*/ dp0 = IOArea call G723_Decode call PutPcmData r0l = *IOArea+G723_D_FRAME_TYPE:x *HDT:x = r0l r0l = *IOArea+G723_WRK_RATE_D:x *HDT:x = r0l r0l = *IOArea+G723_ERR_FRM_COUNT:x *HDT:x = r0l LBC_NEXT: jmp LBC_LOOP LBC_END: nop nop nop nop nop nop nop halt ; ; ; ; comment_out for ; Simulator Test ; ; ; ; ;; ;; ;; ;; ;; ;; ; ; ; ; ; ; ; ; ; 48 User's Manual U13955EJ2V0UM00 APPENDIX SAMPLE PROGRAM SOURCE $EJECT /**/ /*****************************************************************************/ /* Input PCM data for Encode process */ /*****************************************************************************/ Smp_Ix imseg GetPcmData: /*---*/ p0 = EncPcmBuff ; loop G723_FRAME { ; r0l = *HDT:x ; /* */ *dp0++ = r0l ; } ret ; /*****************************************************************************/ /* Output decoded PCM data */ /*****************************************************************************/ Smp_Ix imseg PutPcmData: /*---*/ dp0 = DecPcmBuff ; loop G723_FRAME { ; /* */ r0l = *dp0++ ; *HDT:x = r0l ; } ret ; /*****************************************************************************/ /* Input Code data for Decode process */ /*****************************************************************************/ Smp_Ix imseg GetLineData: /*---*/ dp0 = DecLineBuff ; loop 24/2 { ; r0l = *HDT:x ; /* */ *dp0++ = r0l ; } ret ; /*****************************************************************************/ /* Output Encoded Code data */ /*****************************************************************************/ Smp_Ix imseg PutLineData: /*---*/ dp0 = EncLineBuff ; loop 24/2 { ; /* */ r0l = *dp0++ ; *HDT:x = r0l ; } ret ; /*==================================================================** * Annex C *===================================================================*/ Smp_Ix imseg PutChannelData: User's Manual U13955EJ2V0UM00 49 APPENDIX SAMPLE PROGRAM SOURCE /*---*/ p0 = EncChanBuff; clr(r0); /*...*/ r0l = *(LibEntry + G723C_LIBENTRY_OUTSIZE):x; r0 = r0 + 1; r0 = r0 srl 1; loop r0l { /*...*/ r0l = *dp0++; /*...*/ *HDT:x = r0l; } ret; GetChannelData: /*---*/ dp0 = DecChanBuff; clr(r0); r0l = *HDT:x; /* r0l = the number of words */ loop r0l { /*...*/ r0l = *HDT:x; /*...*/ *dp0++ = r0l; } ret; end 50 User's Manual U13955EJ2V0UM00 Facsimile Message From: Name Company Although NEC has taken all possible steps to ensure that the documentation supplied to our customers is complete, bug free and up-to-date, we readily accept that errors may occur. Despite all the care and precautions we've taken, you may encounter problems in the documentation. Please complete this form whenever you'd like to report errors or suggest improvements to us. Tel. FAX Address Thank you for your kind support. North America Hong Kong, Philippines, Oceania NEC Electronics Inc. NEC Electronics Hong Kong Ltd. Corporate Communications Dept. Fax: +852-2886-9022/9044 Fax: 1-800-729-9288 1-408-588-6130 Korea Europe NEC Electronics Hong Kong Ltd. NEC Electronics (Europe) GmbH Seoul Branch Technical Documentation Dept. Fax: 02-528-4411 Fax: +49-211-6503-274 South America NEC do Brasil S.A. Fax: +55-11-6462-6829 Taiwan NEC Electronics Taiwan Ltd. Fax: 02-2719-5951 Asian Nations except Philippines NEC Electronics Singapore Pte. Ltd. Fax: +65-250-3583 Japan NEC Semiconductor Technical Hotline Fax: 044-435-9608 I would like to report the following error/make the following suggestion: Document title: Document number: Page number: If possible, please fax the referenced page or drawing. Document Rating Clarity Technical Accuracy Organization CS 00.6 Excellent Good Acceptable Poor |
Price & Availability of AP77016-B04 |
|
|
All Rights Reserved © IC-ON-LINE 2003 - 2022 |
[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy] |
Mirror Sites : [www.datasheet.hk]
[www.maxim4u.com] [www.ic-on-line.cn]
[www.ic-on-line.com] [www.ic-on-line.net]
[www.alldatasheet.com.cn]
[www.gdcy.com]
[www.gdcy.net] |